#include<iostream>
#include<cstring>
#include<stack>
using namespace std;

const int maxn = 105;
int map[maxn][maxn];
int indgr[maxn];
stack<int> sk;

int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		int tmp;
		cin>>tmp;
		while(tmp!=0){
			map[i][tmp] = 1;
			indgr[tmp]++;
			cin>>tmp;
		}
	}
	
	int l = 0;
	
	for(int i=1;i<=n;i++){
		while(!sk.empty()){
			sk.pop();
		}
		
		if(indgr[i] != 0){
			continue;
		}else{
			sk.push(i);
			while(!sk.empty()){
				int v = sk.top();
				sk.pop();
				l++;
				cout<<v<<" ";
				for(int j=1;j<=n;j++){
					if(map[v][j]==1){
						map[v][j]=0;
						indgr[j]--;
						if(indgr[j] == 0) 
							sk.push(j);
					}
				}
			}			
		}
		if(l == n)	break;
	}
	//if(l<n)有环 
	cout<<endl;
	return 0;
}